# encoding: utf-8
"""
@author: 夏洛
@QQ: 1972386194
@file: ths.py
"""

import requests, execjs

# http://q.10jqka.com.cn/

with open('./qq.js', encoding='utf-8') as f:
    x = f.read()

v = execjs.compile(x).call('getCookie')


def get_data():
    headers = {
        "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9",
        "Accept-Encoding": "gzip, deflate",
        "Accept-Language": "zh-CN,zh;q=0.9,en-US;q=0.8,en;q=0.7,zh-TW;q=0.6",
        "Cache-Control": "max-age=0",
        "Connection": "keep-alive",
        "Cookie": "v={}".format(v),
        "Host": "q.10jqka.com.cn",
        "Upgrade-Insecure-Requests": "1",
        "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4896.60 Safari/537.36"
    }
    url = 'https://stockpage.10jqka.com.cn/600506/'
    res = requests.get(url, headers=headers)
    print(res.text)


get_data()
